package cn.yuan.xiaoyu.testmodule.activity;

import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import cn.yuan.xiaoyu.R;
import cn.yuan.xiaoyu.commonmodule.activity.BaseActivity;
import cn.yuan.xiaoyu.testmodule.bean.EventProgressBarBean;
import cn.yuan.xiaoyu.testmodule.view.EaseVoiceRecorderView;
import cn.yuan.xiaoyu.testmodule.view.EventProgressBarView;

/**
 * Created by yukuoyuan on 2017/9/21.
 * 这是一个测试intentaction的界面
 */
public class TestIntentActionActivity extends BaseActivity {
    @Bind(R.id.pbv_test)
    EventProgressBarView pbvTest;
    @Bind(R.id.voice_recorder)
    EaseVoiceRecorderView voiceRecorder;
    private List<EventProgressBarBean> list = new ArrayList<>();

    @Override
    protected void bindPresenter() {

    }

    @Override
    protected void initData(Bundle extras) {
        EventProgressBarBean eventProgressBarBean1 = new EventProgressBarBean();
        eventProgressBarBean1.name = "开始";
        eventProgressBarBean1.isChecked = true;
        list.add(eventProgressBarBean1);
        EventProgressBarBean eventProgressBarBean2 = new EventProgressBarBean();
        eventProgressBarBean2.name = "进行中";
        eventProgressBarBean2.isChecked = true;

        list.add(eventProgressBarBean2);

        EventProgressBarBean eventProgressBarBean3 = new EventProgressBarBean();
        eventProgressBarBean3.name = "暂停";
        eventProgressBarBean3.isChecked = false;

        list.add(eventProgressBarBean3);

        EventProgressBarBean eventProgressBarBean4 = new EventProgressBarBean();
        eventProgressBarBean4.name = "结束";
        eventProgressBarBean4.isChecked = false;

        list.add(eventProgressBarBean4);
//        EventProgressBarBean eventProgressBarBean5 = new EventProgressBarBean();
//        eventProgressBarBean5.name = "结束";
//        eventProgressBarBean5.isChecked = false;
//
//        list.add(eventProgressBarBean5);

        pbvTest.setProgessList(list);
        voiceRecorder.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                return voiceRecorder.onPressToSpeakBtnTouch(v, event, new EaseVoiceRecorderView.EaseVoiceRecorderCallback() {

                    @Override
                    public void onVoiceRecordComplete(String voiceFilePath, int voiceTimeLength) {
                    }
                });
            }
        });
        //测试一下看看gitgflow
    }

    @Override
    public int getContentLayout() {
        return R.layout.activity_test_intent_action;
    }

    @Override
    protected void initToolbar() {

    }

}
